<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <form method="post" class="js-ajax-form" action="">
        <div class="form-group">
            <div class="col-md-6 col-sm-10">
                <div class="checkbox">
                    <!--<label class="data-item-tr col-md-3 col-sm-10"><input type="checkbox" name="city[]" value="1" class="js-check" data-name="置顶1">置顶1</label>
                    <label class="data-item-tr col-md-3 col-sm-10"><input type="checkbox" name="city[]" value="6" class="js-check" data-name="置顶6">置顶6</label>-->
                    {$city}

                </div>

            </div>

        </div>

    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $('.data-item-tr').click(function (e) {

        //console.log(e);
        var $this = $(this);
        if ($(e.target).is('input')) {

            return;
        }
        var $input = $this.find('input');

        if ($input.is(':checked')) {

            $input.prop('checked', false);
        } else {
            $input.prop('checked', true);
        }
    });

    function confirm() {
        var selectedCategoriesId   = [];
        var selectedCategoriesName = [];
        var selectedCategories     = [];
        $('.js-check:checked').each(function () {
            var $this = $(this);
            selectedCategoriesId.push($this.val());
            selectedCategoriesName.push($this.data('name'));

            selectedCategories.push({
                id: $this.val(),
                name: $this.data('name')
            });
        });

        return {
            selectedCategories: selectedCategories,
            selectedCategoriesId: selectedCategoriesId,
            selectedCategoriesName: selectedCategoriesName
        };
    }
</script>
</body>
</html>